home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / comm / misc / NullTest_10.lha / NullTest / NullTest.e < prev    next >
Encoding:
Text File  |  1995-04-04  |  2.7 KB  |  82 lines

  1. MODULE 'intuition/intuition'
  2.  
  3. CONST BUFSIZE=GADGETSIZE*7, IFLAGS=IDCMP_CLOSEWINDOW+IDCMP_GADGETUP
  4.  
  5. DEF buf[BUFSIZE]:ARRAY,next,w:PTR TO window,gadid,gad:PTR TO gadget,
  6.     msg:PTR TO intuimessage,port,class
  7.  
  8. PROC main()
  9.    next:=Gadget(buf,NIL,1,0,20,20,100,  'Set DTR')
  10.    next:=Gadget(next,buf,2,0,20,35,100, 'Set RTS')
  11.    next:=Gadget(next,buf,3,0,20,50,100, 'Clear DTR')
  12.    next:=Gadget(next,buf,4,0,20,65,100, 'Clear RTS')
  13.    next:=Gadget(next,buf,7,0,20,80,100, 'DTR <> RTS')
  14.    next:=Gadget(next,buf,5,0,140,65,100,'Toggle DTR')
  15.    next:=Gadget(next,buf,6,0,140,80,100,'Toggle RTS')
  16.    IF w:=OpenW(20,11,300,100,IFLAGS,$F,'NULL Modem Tester',NIL,1,buf)
  17.       Box(140,20,180,40,2) ; Box(190,20,230,40,2)
  18.       Colour(1,0)
  19.       TextF(150,50,'DSR') ; TextF(200,50,'CTS')
  20.       port:=w.userport
  21.       LOOP
  22.          IF (msg:=GetMsg(port))<>NIL
  23.             class:=msg.class ; gad:=msg.iaddress ; gadid:=gad.userdata
  24.             ReplyMsg(msg)
  25.             SELECT class
  26.             CASE IDCMP_GADGETUP
  27.                SELECT gadid
  28.                CASE 1
  29.                   BSET  #7,$BFD000        /*  Set DTR  */
  30.                CASE 2
  31.                   BSET  #6,$BFD000        /*  Set RTS  */
  32.                CASE 3
  33.                   BCLR  #7,$BFD000        /* Clear DTR */
  34.                CASE 4
  35.                   BCLR  #6,$BFD000        /* Clear RTS */
  36.                CASE 5
  37.                   REPEAT
  38.                      BSET  #7,$BFD000     /*  Set DTR  */
  39.                      Delay(25)
  40.                      BCLR  #7,$BFD000     /* Cleat DTR */
  41.                      Delay(25)
  42.                   UNTIL Mouse()=1
  43.                CASE 6
  44.                   REPEAT
  45.                      BSET  #6,$BFD000     /*  Set RTS  */
  46.                      Delay(25)
  47.                      BCLR  #6,$BFD000     /* Clear RTS */
  48.                      Delay(25)
  49.                   UNTIL Mouse()=1
  50.                CASE 7
  51.                   REPEAT
  52.                      BSET  #6,$BFD000     /*  Set RTS  */
  53.                      Delay(25)
  54.                      BCLR  #6,$BFD000     /* Clear RTS */
  55.                      BSET  #7,$BFD000     /*  Set DTR  */
  56.                      Delay(25)
  57.                      BCLR  #7,$BFD000     /* Clear DTR */
  58.                   UNTIL Mouse()=1
  59.                ENDSELECT
  60.             CASE IDCMP_CLOSEWINDOW
  61.                JUMP exitpr
  62.             ENDSELECT
  63.          ENDIF
  64.  
  65.          BTST  #3,$BFD000     /*  Check DSR  */
  66.          BNE   dsron
  67.          Box(140,20,180,40,2)   /* White box */
  68.          BRA   dsroff
  69. dsron:   Box(140,20,180,40,3)   /* Red box */
  70. dsroff:  BTST  #4,$BFD000     /* Check CTS */
  71.          BNE   ctson
  72.          Box(190,20,230,40,2)  /* White box */
  73.          BRA   ctsoff
  74. ctson:   Box(190,20,230,40,3)  /* Red box */
  75. ctsoff:
  76.       ENDLOOP
  77. exitpr:
  78.       CloseW(w)
  79.    ENDIF
  80. ENDPROC
  81.  
  82.